package vn.com.bookstore.model;

import java.util.ArrayList;
import java.util.List;

import vn.com.bookstore.ObjectStore;
import android.util.Log;

import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;

@SuppressWarnings("serial")
public class ListBook extends ObjectStore {
	public ArrayList<Book> book;

	public static List<Book> parseListGson(String json) {
		Log.e("___ListBook", "____khac.pvan: " + json);
		Gson gson = new Gson();
		try {
			ListBook obj = gson.fromJson(json, ListBook.class);
			return obj.book;
		} catch (JsonSyntaxException e) {
			try {
				Temp obj2 = gson.fromJson(json, Temp.class);
				ArrayList<Book> result = new ArrayList<Book>();
				result.add(obj2.book);
				return result;
			} catch (Exception er) {
				return new ArrayList<Book>();
			}
		} catch (Exception e) {
			return new ArrayList<Book>();
		}

	}

}
